﻿using System.Text.Json.Serialization;

namespace OpenAIProxy;

public class OpenAIConfig
{
    public string Endpoint { get; set; }
    public string ApiKey { get; set; }
}

public class FileStorageConfig
{
    public string ChatDirectory { get; set; }
    public string LogDirectory { get; set; }
    public int MaxChatFileSizeMB { get; set; }
    public int MaxLogFileSizeMB { get; set; }
    public int MaxFilesToKeep { get; set; }
}
public class OpenAIChatRequest
{
    public string Model { get; set; } = "gpt-3.5-turbo";
    public List<ChatMessage> Messages { get; set; }
    public bool? Stream { get; set; }
    public double Temperature { get; set; }
}

public class ChatMessage
{
    [JsonPropertyName("role")]
    public string Role { get; set; }
    [JsonPropertyName("content")]
    public string Content { get; set; }
}

public class OpenAIChatResponse
{
    [JsonPropertyName("choices")]
    public List<ChatChoice> Choices { get; set; }
    [JsonPropertyName("usage")]
    public Usage Usage { get; set; }
}

public class ChatChoice
{
    [JsonPropertyName("message")]
    public ChatMessage Message { get; set; }
}

public class Usage
{
    [JsonPropertyName("prompt_tokens")]
    public int PromptTokens { get; set; }
    [JsonPropertyName("completion_tokens")]
    public int CompletionTokens { get; set; }
}

public class ChatRecord
{
    public Guid Id { get; } = Guid.NewGuid();
    public DateTime Timestamp { get; } = DateTime.UtcNow;
    public string Request { get; set; }
    public string Response { get; set; }
    public int PromptTokens { get; set; }
    public int CompletionTokens { get; set; }
    public string Provider { get; set; }
    public string Model { get; set; }
    public decimal Cost { get; set; }
}
